<template>
  <div>
    <a-select  placeholder="请输入车场" :value="selectedParkCode" @change="one">
      <a-select-option value="">请选择车场</a-select-option>
      <a-select-option v-for="parkInfo in parkInfoList" :value="parkInfo.parkCode" :key="parkInfo.id">
        {{ parkInfo.parkName }}
      </a-select-option>
    </a-select>
  </div>
</template>
<script>

import {getParkInfoList} from "@api/api";

export default {

  name: 'parkInfoList',
  data() {
    return {
      parkCode: "",
      parkInfoList: [],
      selectedParkCode:"请选择车场"
    }
  },
  mounted() {
    this.initParkInfoList();

  },
  created() {
  },
  methods: {

    one(parkCode) {
      this.selectedParkCode=parkCode;
      this.$emit('departChange', parkCode);
    },
    initParkInfoList() {
      getParkInfoList().then((res) => {
        if (res.success) {
          this.parkInfoList = res.result;
        }
      })
    },
    resetOption() {
      this.selectedParkCode = "请选择车场";
    }
  }
}
</script>
